package com.wise.service.portal.content.websuccesscolumns;

import com.wise.entities.content.SuccessArticleColumn;
import com.wise.framework.dao.SqlSelect;
import com.wise.framework.daomodel.DaoList;
import com.wise.framework.daomodel.DaoPageList;
import com.wise.framework.restful.PageResultList;
import com.wise.model.content.enums.ArticleColumnShowStatus;
import com.wise.summer.v1.portal.content.websuccesscolumns.ListWebSuccessColumns;
import org.springframework.stereotype.Service;
import org.summerframework.model.SummerService;
import org.summerframework.model.SummerServiceBean;


@Service
@SummerService
public class ListWebSuccessColumnsService implements SummerServiceBean<ListWebSuccessColumns> {
	@Override
	public void sum(ListWebSuccessColumns model) {
		SqlSelect sql = SqlSelect.selec("*")
				.fromClassName(SuccessArticleColumn.class)
				.eq(SuccessArticleColumn._showState, ArticleColumnShowStatus.SHOW.value())
				.eqLang(SuccessArticleColumn._lang)
				.order_by(SuccessArticleColumn._sort)
				.order_by(SuccessArticleColumn._id + " desc");
		PageResultList<ListWebSuccessColumns.Result> articleColumnList = DaoPageList.s(ListWebSuccessColumns.Result.class, sql, model.getStart(), model.getLimit());
		model.setSummerResult(articleColumnList);
	}
}
